<template>
    <div>
        <client-details-header :brand="userDetail.brand" :model="userDetail.model" :hideDelete="hideDelete"
                               :licensePlate="userDetail.licencePlate" :carNumber="userDetail.carNumber"></client-details-header>
        <client-details-expense :latestChatStore="userDetail.latestChatStore" :latestChatDate="userDetail.latestChatDate" :hideDelete="hideDelete"
                                :cxjAmtTotal="userDetail.cxjAmtTotal" :currentAppActiveDate="userDetail.currentAppActiveDate"
                                :cxjTimesTotal="userDetail.cxjTimesTotal"></client-details-expense>
        <client-details-remark :showDelete="showDelete" :hideDelete="hideDelete"></client-details-remark>
        <client-details-indent :hideDelete="hideDelete"></client-details-indent>
    </div>
</template>
<script>
    import ClientDetailsHeader from './clientDetailsHeader.vue';
    import ClientDetailsExpense from './clientDetailsExpense.vue';
    import ClientDetailsIndent from './clientDetailsIndent.vue';
    import ClientDetailsRemark from './clientDetailsRemark.vue';
    export default{
        data: function () {
            return {
                userDetail:{},
                showDelete: false,//是否动画显示删除按钮
            }
        },
        methods: {
            hideDelete(){
                this.showDelete = !this.showDelete;
                console.log('隐藏删除按钮');
            }
        },
        components: {
            ClientDetailsHeader,
            ClientDetailsExpense,
            ClientDetailsIndent,
            ClientDetailsRemark
        },
        created(){
            this.$http.get('/mobile/storeManagement/getUserDetail?userId=' + this.userId).then(function (res) {
                res = res.body;
                if(res.code == 0){
                    res = res.result;
                    this.userDetail = res;
                    if(this.userDetail.currentAppActiveDate == null){
                        this.userDetail.currentAppActiveDate = ' - - ';
                    }
                }else {
                    console.warn(res.code);
                }
            }, function (err) {
                console.warn('错误码'+ err.status);
            });
        }
    }
</script>
